//
//  GetPosView.m
//  YTwallet
//
//  Created by ZhangLin on 2019/3/18.
//  Copyright © 2019年 hadrlog. All rights reserved.
//

#import "GetPosView.h"
#import <Masonry.h>
@implementation GetPosView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setupViews];
    }
    return self;
}

-(void)setupViews{
    

    UIImage *image = [UIImage imageNamed:@"pos_bg"];
    self.contentMode = UIViewContentModeScaleAspectFill;
    self.layer.contents = (id)image.CGImage;


    
    self.tipsLab = [[UILabel alloc] init];
    self.tipsLab.text = @"快来领取POS机啦~";
    self.tipsLab.font = [UIFont systemFontOfSize:20];
    self.tipsLab.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    [self addSubview:self.tipsLab];
    [self.tipsLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(80);
        make.left.mas_equalTo(35);
    }];
    
    self.giftImv = [[UIImageView alloc] init];
    self.giftImv.image = [UIImage imageNamed:@"pos_icon_gift"];
    [self addSubview:self.giftImv];
    [self.giftImv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.tipsLab.mas_right);
        make.centerY.equalTo(self.tipsLab);
        make.width.mas_equalTo(30);
        make.height.mas_equalTo(30);
    }];
    
    self.applyPosLab = [[UILabel alloc] init];
    self.applyPosLab.text = @"留下您的联系方式,进行申请";
    self.applyPosLab.font = [UIFont systemFontOfSize:12];
    self.applyPosLab.textColor = [UIColor colorWithRed:138 / 255.0 green:146 / 255.0 blue:199 / 255.0 alpha:1];
    [self addSubview:self.applyPosLab];
    [self.applyPosLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.tipsLab.mas_bottom).offset(5);
        make.left.equalTo(self.tipsLab);
    }];
    
    self.nameTf = [[UITextField alloc] init];
    self.nameTf.placeholder = @"请输入联系人";
    [self addSubview:self.nameTf];
    [self.nameTf mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.tipsLab);
        make.right.mas_equalTo(-125);
        make.top.equalTo(self.applyPosLab.mas_bottom).offset(50);
        make.height.mas_equalTo(60);
    }];
    
    self.nameLineView = [[UIView alloc] init];
    self.nameLineView.backgroundColor = [UIColor colorWithRed:229 / 255.0 green:229 / 255.0 blue:229 / 255.0 alpha:1];
    [self addSubview:self.nameLineView];
    [self.nameLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameTf);
        make.right.equalTo(self.nameTf);
        make.bottom.equalTo(self.nameTf);
        make.height.mas_equalTo(1);
    }];
    
    
    self.phoneTf = [[UITextField alloc] init];
    self.phoneTf.placeholder = @"请输入您的手机号";
    [self addSubview:self.phoneTf];
    [self.phoneTf mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.tipsLab);
        make.right.mas_equalTo(-35);
        make.top.equalTo(self.nameTf.mas_bottom);
        make.height.mas_equalTo(60);
    }];
    
    self.phoneLineView = [[UIView alloc] init];
    self.phoneLineView.backgroundColor = [UIColor colorWithRed:229 / 255.0 green:229 / 255.0 blue:229 / 255.0 alpha:1];
    [self addSubview:self.phoneLineView];
    [self.phoneLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.phoneTf);
        make.right.equalTo(self.phoneTf);
        make.bottom.equalTo(self.phoneTf);
        make.height.mas_equalTo(1);
    }];
    
    
    self.addressTf = [[UITextField alloc] init];
    self.addressTf.placeholder = @"请输入寄件地址";
    [self addSubview:self.addressTf];
    [self.addressTf mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.tipsLab);
        make.right.mas_equalTo(-35);
        make.top.equalTo(self.phoneTf.mas_bottom);
        make.height.mas_equalTo(60);
    }];
    
    self.addressLineView = [[UIView alloc] init];
    self.addressLineView.backgroundColor = [UIColor colorWithRed:229 / 255.0 green:229 / 255.0 blue:229 / 255.0 alpha:1];
    [self addSubview:self.addressLineView];
    [self.addressLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.addressTf);
        make.right.equalTo(self.addressTf);
        make.bottom.equalTo(self.addressTf);
        make.height.mas_equalTo(1);
    }];
    
    self.applyBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.applyBtn.backgroundColor = [UIColor colorWithRed:219 / 255.0 green:224 / 255.0 blue:255 / 255.0 alpha:1];
    self.applyBtn.layer.cornerRadius = 22;
    [self.applyBtn setTitle:@"提交申请" forState:(UIControlStateNormal)];
    [self.applyBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    [self addSubview:self.applyBtn];
    [self.applyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(40);
        make.right.mas_equalTo(-40);
        make.height.mas_equalTo(44);
        make.bottom.mas_equalTo(-65);
    }];
    
    
}

@end
